<template>
	<view class="padd">
		<el-row :gutter="24">
		  <el-col :span="24" >
				<el-alert
				    title="尺寸：67*60,严格遵守图片尺寸"
				    type="error">
				  </el-alert>
			</el-col>
			
		</el-row>
		<el-row>
			<el-col :span="12">
				<uni-file-picker
				return-type="object"
				    v-model="imageValue" 
				    fileMediatype="image" 
				    mode="grid" 
				    @select="select" 
				    @progress="progress" 
				    @success="success" 
				    @fail="fail" 
				></uni-file-picker>
			</el-col>
		</el-row>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				logoname:{
					logoSrc: '',
					studioName: ""
				},
				imageValue:[]
			}
		},
		onShow() {
			uniCloud.callFunction({
				name:'logoname',
				data:{sign:1}//标示：查询用，必填
			}).then((res)=>{
				console.log('res',res)
				if (res.result.data.length>0) {
					// this.imageValue.push(res.result.data[0].logoSrc) 
					this.logoname = res.result.data[0]
				} else{
					this.$message.error('数据初始化错误，刷新啊！')
				}
			})
		},
		methods: {
			select(e){
			    console.log('选择文件：',e)
			},
			// 获取上传进度
			progress(e){
			    console.log('上传进度：',e)
			},
					
			// 上传成功
			success(e){
			    console.log('上传成功',e)
					uniCloud.getTempFileURL({
					        fileList: [e.tempFiles[0].url]
					    })
					    .then(res => {
								console.log('imageValue',this.imageValue)
								console.log('res',res)
								this.logoname.logoSrc = res.fileList[0].fileID
								uniCloud.callFunction({
									name:'logoname',
									data:Object.assign(this.logoname,{sign:3}),
								}).then((res)=>{
									console.log('res1',res)
								})
							});
			},
					
			// 上传失败
			fail(e){
			    console.log('上传失败：',e)
			},
		}
	}
</script>

<style>

</style>
